class CreateSalesContacts < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_contacts do |t|
      t.integer :firm_id, comment: '所属公司'
      t.string :name, comment: '姓名'
      t.string :email, comment: '邮箱'
      t.string :phone, comment: '联系电话'
      t.string :phone_ext, comment: '分机号'
      t.boolean :phone_same_with_firm, comment: '是否公司号码'
      t.string :mobile, comment: '手机'
      t.string :notes, comment: '备注'
      t.boolean :active, comment: '是否在职', default: true
      t.string :position, comment: '职位名称'
      t.string :salutation, comment: '称谓'
      t.boolean :key_person, comment: '是否关键联系人'

      t.timestamps
    end
    add_index :sales_contacts, :firm_id
    add_index :sales_contacts, :name
    add_index :sales_contacts, :email
    add_index :sales_contacts, :mobile
    add_index :sales_contacts, :active
    add_index :sales_contacts, :key_person
  end
end
